var List = (function () {
    return {
        editEntity: function ($this) {
            var id = $($this).parents("tr").attr("data-tt-id");
            window.location.href = root + "/security/resource/input.do?id=" + id;
        },
        deleteEntity: function ($this) {
            var id = $($this).parents("tr").attr("data-tt-id");
            var isLeaf = jQuery($this).parents("tr").hasClass("leaf");
            if (!isLeaf) {
                $().toastmessage('showToast', {
                    text: "此资源包含子资源，不能删除！",
                    stayTime: 3000,
                    sticky: false,
                    position: 'top-center',
                    type: 'warning'
                });
            } else {
                batchDel(id, root + "/security/resource/delete.do", root + "/security/resource/list.do");
            }
        },
    }
})();

function add() {
    window.location.href = root + "/security/resource/input.do";
}